-
Notifications
You must be signed in to change notification settings - Fork 334
[feat] referrals system #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit introduces a new knowledge file for database schema design principles. It covers general guidelines for schema simplicity and efficiency, as well as specific recommendations for user and referral table designs. Key points include: - Reusing existing fields when possible - Using composite primary keys where appropriate - Utilizing the 'quota' field for multiple purposes - Efficient design for referral systems These principles aim to improve database performance and maintainability.
This commit outlines the database schema changes and implementation steps for the new referral feature. It includes: - Updates to the user table - Creation of a new referral table - Detailed implementation steps covering database, API, UI, and testing - Guidelines for using existing fields and efficient schema design The plan provides a comprehensive roadmap for developing the referral system, ensuring consistency and efficiency across the application.
This commit introduces a referral system to the application: - Add 'referral_code' field to user table - Create new 'referral' table to track referrals - Update schema.ts with new fields and table definitions The referral system will allow users to invite others and track the status of their referrals. This lays the groundwork for future features like referral bonuses or rewards.
This commit introduces a referral system with the following changes: - Create 'referral' table to track referrals between users - Add 'referral_code' column to 'user' table - Implement 'ReferralStatus' enum for tracking referral status - Update schema and types to support new referral functionality These changes lay the groundwork for implementing user referrals and tracking their status within the application.
This commit introduces a new referrals page where users can view and manage their referral code and referrals. It also adds a link to the referrals page in the navbar for authenticated users. Key changes: - Create new ReferralsPage component with referral code and list - Add referrals link to navbar for logged-in users - Implement basic UI for displaying referral information
This commit introduces a new API route (/api/referrals) to retrieve referral information for authenticated users. The route fetches the user's referral code and a list of their referrals from the database. The implementation includes: - Authentication check using NextAuth - Database queries to fetch referral code and referrals - Error handling for unauthorized access and server errors This feature supports the referral system functionality in the web app.
This commit introduces TanStack Query for efficient data fetching and state management in the referrals feature. It includes: - Adding @tanstack/react-query as a dependency - Updating the knowledge.md file with TanStack Query usage guidelines - Refactoring the referrals API route for optimized data retrieval - Implementing TanStack Query in the ReferralsPage component - Updating the referrals UI to display fetched data correctly These changes improve performance, error handling, and code maintainability for the referrals feature.
- Introduce ReferralData type for improved type safety - Optimize referral data processing in API route - Implement React Query for efficient data fetching and caching - Enhance error handling and loading states in UI - Extract copyReferralCode function for reusability - Update UI to use new data structure and loading states
This commit adds React Query setup to the root layout and updates the knowledge base documentation with instructions on how to properly initialize React Query in the application. These changes enable the use of useQuery hooks throughout the app for efficient data fetching and state management.
This commit moves the QueryClientProvider logic into a separate component. It improves code organization and allows for better state management of the QueryClient instance. The new QueryProvider component is now used in the root layout, simplifying the main layout file and enhancing reusability.
This commit introduces a new Skeleton component to enhance the user experience during loading states. The component uses animation and styling to provide a visual placeholder while content is being fetched or processed. The Skeleton component is flexible and can be customized through className props, allowing for easy integration across different parts of the application.
- Add loading states using Skeleton components - Refresh usage on 100% warning in CLI - Update pricing URL to use environment variable - Reset warning percentage on plan change - Update knowledge.md with UI component guidelines - Refactor referrals page for better readability
- Replace hardcoded support email with environment variable - Remove commented code in referrals page - Improve error handling in onboarding process These changes enhance maintainability and code cleanliness.
This commit adds functionality for users to apply referral codes: - Create POST endpoint in /api/referrals to handle code submission - Add input field and apply button on referrals page - Implement client-side mutation for applying referral codes - Display success/error messages using toast notifications - Refetch referral data after successful code application These changes enhance the referral system by allowing users to enter and benefit from referral codes, completing the referral loop.
- Change key prop to use referral.id for uniqueness - Display referral name or email instead of referred_id - Improve readability and user experience in referrals list
This commit updates the referral system implementation to: - Enhance database schema documentation - Optimize API route for fetching referral data using Drizzle ORM - Update frontend to display referred user information correctly - Improve code organization and readability These changes streamline the referral system, making it more efficient and easier to maintain.
This commit updates the GET handler for the referrals API route to improve data fetching efficiency and accuracy. Key changes include: - Replace user query with direct referral query - Filter for completed referrals only - Adjust data structure to match new query results - Enhance error handling for missing user ID These changes aim to optimize performance and ensure only relevant, completed referrals are returned to the client.
This commit updates the referral feature implementation: - Revise database schema documentation - Optimize referral data retrieval in API route - Update referrals page to display improved data structure - Enhance type definitions for better code clarity - Streamline API response format for frontend consumption These changes improve performance and maintainability of the referral system while providing a clearer data structure for the frontend to work with.
This commit improves the referral system by adding detailed security measures and implementation guidelines. Key changes include: - Prevent self-referrals to avoid system abuse - Limit referral code usage to 5 times for better distribution - Implement rate limiting for code generation to prevent spam - Add implementation tips for middleware, database operations, and concurrent request handling These enhancements aim to create a more robust and secure referral system, reducing potential exploitation while maintaining usability.
- Implement security measures in GET method of referrals API - Add referral count limit and self-referral check - Update frontend to display referrals and handle errors - Improve data structure for referral information - Refactor code for better readability and maintainability
- Fix referral queries in API route - Enhance referrals page UI with conditional rendering - Display referrer information when available - Adjust footer layout and wording - Update input handling for referral code application
The updated plan includes: - Reorganized sections for better flow - Added UI components section - Moved user quota update to API routes - Removed redundant backend logic section - Consolidated security measures under API routes - Refined implementation tips for API routes These changes provide a more comprehensive and organized approach to implementing the referral system.
|
Your free trial has expired. To keep using Ellipsis, sign up at https://app.ellipsis.dev for $20/seat/month or reach us at help@ellipsis.dev |
brandonkachen
commented
Oct 9, 2024
| @@ -0,0 +1,88 @@ | |||
| # Referral Feature Implementation Plan | |||
Collaborator
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will prob delete this before merging
Update environment variable usage across the project Enhance referral system with credit tracking Improve onboarding and redeem page functionality
- Add logout command to CLI - Implement referral code redemption for logged-in users - Refactor login process and referral code handling - Update onboarding page to use new referral code redemption - Simplify referrals page and footer component
Collaborator
Author
all fixed now! |
This commit enhances the referral system by adding a check for self-referrals. It modifies the API to return whether the referral code belongs to the current user and updates the UI to display a warning message in such cases. This prevents users from accidentally trying to redeem their own referral codes and improves the overall user experience of the referral system.
This commit simplifies the usage limit message by removing the specific upgrade instructions. It keeps the core message about reaching the monthly limit without directing users to a particular action, allowing for more flexibility in how this information is presented or handled in different contexts.
This commit enhances the usage warning feature by incorporating a referral system. It adds a referral link to the usage response for eligible users, displays this link in the CLI usage warnings, and updates the knowledge base to reflect these changes. The goal is to encourage user growth by promoting referrals when users approach their usage limits.
This commit centralizes the referral link generation logic by: 1. Creating a shared function in common/src/util 2. Updating the backend websocket handler to use this function 3. Modifying the web API to utilize the shared function 4. Updating the knowledge base with best practices for code organization These changes improve code reusability and maintainability across the project, adhering to the DRY principle and promoting consistent implementation of referral functionality.
This commit introduces several changes to the referral system: - Implement a new function to centralize referral eligibility logic - Move referral link generation to the backend for better security - Update frontend to handle referral limits and display appropriate messages - Improve code organization by applying Single Responsibility Principle - Enhance error handling and type safety in referral-related functions - Update documentation with new development guidelines These changes aim to improve maintainability, security, and user experience of the referral system.
- Implement consistent referral limit checks - Use hasMaxedReferrals function for limit enforcement - Update GET and POST handlers in referrals route - Add detailed referral system documentation - Remove redundant code and improve error handling
This commit refactors the referral system to improve code organization and enhance user experience. Key changes include: - Move server-specific referral logic to a new file - Update referral limit checks and error messages - Improve usage warning display in the npm client - Centralize referral link generation - Update API endpoints to use new referral functions - Enhance referral page to use consistent link generation These changes aim to make the referral system more robust and user-friendly while improving code maintainability.
This commit centralizes the MAX_REFERRALS constant in constants.ts and updates its imports across the codebase. It improves code organization and maintainability by keeping all constants in a single location. The changes include: - Adding MAX_REFERRALS to constants.ts - Updating imports in referral.ts and route.ts - Removing duplicate constant definition in referral.ts This refactoring ensures consistency and reduces the risk of discrepancies in referral-related logic across the application.
This commit introduces a new knowledge.md file in the common directory, documenting key aspects of the Manicode project structure, constants, and referral system. It also corrects an import path in the referral utility file to use a relative path for better module resolution. These changes improve project documentation and code organization, making it easier for developers to understand and maintain the codebase.
This commit adds information about important constants and the referral system to the knowledge.md file. It includes details on: - Location of constants in common/src/constants.ts - Key constants like MAX_REFERRALS and CREDITS_REFERRAL_BONUS - Overview of the referral system implementation - Files involved in the referral system This update helps developers understand the project structure and key components related to constants and the referral system.
This commit removes the outdated constants section from the knowledge.md file. The information about important constants and their definitions has been moved to a more appropriate location in the codebase, improving overall documentation structure and maintainability.
This commit improves the referral system by: - Optimizing the database query in hasMaxedReferrals function - Updating referral system documentation in knowledge.md It also enhances usage limit handling in the CLI by: - Moving the usage limit warning from CLI to Client class - Ensuring proper control flow when usage limit is reached These changes improve code organization and user experience.
This commit addresses two main changes: 1. Corrects the referral query in referral.ts by properly joining the user table and uncommenting the where clause. 2. Adds a usage check in the CLI's printInitialPrompt method to fetch and display user usage information before the prompt. These changes improve the accuracy of referral tracking and enhance the user experience by providing usage information upfront.
This commit addresses two issues: 1. In the backend, the 'user-input' action subscription is updated to properly wrap the callback function with protec.run(). 2. In the npm-app client, the usage response output is modified to include a newline character before printing, improving readability in the console. These changes enhance the reliability of websocket actions and improve the user experience when displaying usage information.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://www.tella.tv/video/referral-program-explained-7qdh
important: when we deploy, make sure to change APP_URL to NEXT_PUBLIC_APP_URL in our environment variables!